
import socketserver

class Myserver(socketserver.BaseRequestHandler):
    def handle(self): #自动触发handle方法，并且self.request == conn
        msg = self.request.recv(1024).decode('utf-8')
        print(msg)

server = socketserver.ThreadingTCPServer(('127.0.0.1', 9000),Myserver)
server.serve_forever()
